/**
 * Created by xxcao on 2017/6/14.
 */


var express = require('express');
var router = express.Router();
var util = require('../util/util');
var issueDao = require('../dao/issueDao');

//创建问题
router.post('/create', function(req, res, next) {
    if(util.removeFavicon(req,res)) {
        util.logInfo(0, 'issue/create', 'POST', req.body);
        issueDao.create(req, res, next);
    }
});

//删除问题
router.post('/delete', function (req, res, next) {
    if(util.removeFavicon(req,res)) {
        util.logInfo(0, 'issue/delete', 'POST', req.body);
        issueDao.delete(req, res, next);
    }
});

//完成问题
router.put('/commit', function (req, res, next) {
    if(util.removeFavicon(req,res)) {
        util.logInfo(0, 'issue/commit', 'PUT', req.body);
        issueDao.commit(req, res, next);
    }
});

//已确认完成问题
router.put('/confirm', function (req, res, next) {
    if(util.removeFavicon(req,res)) {
        util.logInfo(0, 'issue/confirm', 'PUT', req.body);
        issueDao.confirm(req, res, next);
    }
});

//打回问题
router.put('/rollback', function (req, res, next) {
    if(util.removeFavicon(req,res)) {
        util.logInfo(0, 'issue/rollback', 'PUT', req.body);
        issueDao.rollback(req, res, next);
    }
});

module.exports = router;
